package com.haierp.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;

/**
 * 类目
 * @author zhulu
 *
 */
public class Category implements Serializable{


	/** 主键id */
	@TableId(type = IdType.AUTO)
	private Long id;

	/** 类目名称 */
	private String name;
	
	/** 父级类目id */
	private Long pid;
	
	/**
	 * 类目级别
	 */
	private Integer level;
	/**
	 * 排序
	 */
	private Integer seq;
	
	/** 一级类目id */
	@TableField(value = "one_pid")
	private Long onePId;
	/**
	 * 二级或者三级类目的全路径名称
	 */
	@TableField(value = "all_path")
	private String allPath;
	
	private Integer status;
	@TableField(value = "gmt_create")
	private Date gmtCreate;
	@TableField(value = "gmt_modify")
	private Date gmtModify;
	@TableField(value = "user_create")
	private String userCreate;
	@TableField(value = "user_modify")
	private String userModify;
	@TableField(exist = false)
	private List<Category> children = new ArrayList<Category>();
	@TableField(exist = false)
	public static Map<Long, String> categoryCode = new HashMap<Long, String>();
	static {
		categoryCode.put(9L,  "0101001");
		categoryCode.put(10L, "0102001");
		categoryCode.put(11L, "0103001");
		categoryCode.put(12L, "0104001");
		categoryCode.put(13L, "0105001");
		categoryCode.put(14L, "0106001");
		categoryCode.put(15L, "0107001");
		categoryCode.put(46L, "0108001");
		categoryCode.put(20L, "0201001");
		categoryCode.put(21L, "0202001");
		categoryCode.put(22L, "0203001");
		categoryCode.put(48L, "0204001");
		categoryCode.put(29L, "0301001");
		categoryCode.put(30L, "0302001");
		categoryCode.put(31L, "0303001");
		categoryCode.put(32L, "0304001");
		categoryCode.put(33L, "0305001");
		categoryCode.put(50L, "0306001");
		categoryCode.put(40L, "0401001");
		categoryCode.put(41L, "0402001");
		categoryCode.put(42L, "0403001");
		categoryCode.put(43L, "0404001");
		categoryCode.put(44L, "0405001");
		categoryCode.put(52L, "0406001");
		categoryCode.put(53L, "0102011");
		categoryCode.put(54L, "0107011");
		categoryCode.put(56L, "0301011");
	}
	
	public List<Category> getChildren() {
		return children;
	}
	public void setChildren(List<Category> children) {
		this.children = children;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Long getPid() {
		return pid;
	}
	public void setPid(Long pid) {
		this.pid = pid;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public Integer getSeq() {
		return seq;
	}
	public void setSeq(Integer seq) {
		this.seq = seq;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Date getGmtCreate() {
		return gmtCreate;
	}
	public void setGmtCreate(Date gmtCreate) {
		this.gmtCreate = gmtCreate;
	}
	public Date getGmtModify() {
		return gmtModify;
	}
	public void setGmtModify(Date gmtModify) {
		this.gmtModify = gmtModify;
	}
	public String getUserCreate() {
		return userCreate;
	}
	public void setUserCreate(String userCreate) {
		this.userCreate = userCreate;
	}
	public String getUserModify() {
		return userModify;
	}
	public void setUserModify(String userModify) {
		this.userModify = userModify;
	}
	
	public String getValue(){
		return this.id+"";
	}
	
	public String getLabel(){
		return this.name;
	}

	public Long getOnePId() {
		return onePId;
	}
	public void setOnePId(Long onePId) {
		this.onePId = onePId;
	}
	public String getAllPath() {
		return allPath;
	}
	public void setAllPath(String allPath) {
		this.allPath = allPath;
	}

	
}
